package com.zg.common.core.dao.system;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zg.common.core.dao.system.mapper.SysDictMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zxb
 */
@Service
public class SysDictDao extends ServiceImpl<SysDictMapper, SysDict> {

    public List<SysDict> listByCodes(List<String> codes) {
        LambdaQueryWrapper<SysDict> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(SysDict::getCode, codes);
        queryWrapper.isNull(SysDict::getPid);
        return baseMapper.selectList(queryWrapper);
    }

    public List<SysDict> listByPid(List<Long> pids) {
        LambdaQueryWrapper<SysDict> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(SysDict::getPid, pids);
        queryWrapper.orderByAsc(SysDict::getId);
        return baseMapper.selectList(queryWrapper);
    }

}
